<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.12/vue.js"></script>
</head>
<body>
<div id="app">
    <button @click="unWatch">取消监听</button>
    <button @click="count++">监听count</button>
    <p>{{count}}</p>
</div>
<script>
    Vue.config.productionTip = false
    const vm = new Vue({
        el: '#app',
        data() {
            return {
                count:1
            }
        },
        methods:{
            unWatch:()=>{}
        }
    })

    vm.unWatch = vm.$watch('count',function (){
        console.log('监听到了count的变化')
    },{
        deep:true,
        immediate:true
    })
</script>
</body>
</html>